// 日志功能测试
#include "../src/Log.h"
void DefineTest()
{
    DEBUG("%s", "日志测试开始");
    unique_ptr<LogManager::LoggerBuilder> loggerbuild(new LogManager::GlobalLoggerBuilder());
    loggerbuild->buildLoggerName("Async_Logger");
    loggerbuild->buildFormatter("[%c][%f:%l][%p]%m%n");
    loggerbuild->buildLoggerLevel(Level::LogLevel::value::DEBUG);
    // 日志输出方式
    loggerbuild->buildLoggerType(LogManager::LoggerType::SYNC_Logger);
    // loggerbuild->buildUnSafeLopperType();---->极限性能测试

    // 四种不同的落地方向
    loggerbuild->buildSink<Sink::StdoutSink>();
    loggerbuild->buildSink<Sink::FileSink>("./logfile/Async.log");
    loggerbuild->buildSink<Sink::RollBySizeSink>("./logfile/roll-by-size-Async-", 1024 * 1024);
    loggerbuild->build();
    LogManager::Logger::ptr logger = LogManager::LoggerManager::GetInstance().getLogger("Async_Logger");
    logger->info("%s", "日志测试");
    logger->debug("%s", "日志测试");
    logger->warn("%s", "日志测试");
    logger->error("%s", "日志测试");
    logger->fatal("%s", "日志测试");
    /*以时间进行文件滚动*/
    // loggerbuild->buildSink<Sink::RollByTimeSink>("./logfile/roll-by-tIme-Async-", Sink::TimeGap::GAP_SECOND);
    // time_t cur = Util::Data::GetTime();
    // while (Util::Data::GetTime() < cur + 5)
    // {
    //     logger->fatal("%s", "这是一条测试用例");
    // }
    INFO("%s", "日志测试结束");
}
int main()
{
    DefineTest();
    return 0;
}